package com.example.redisrabbitesintegeation.common.config;

import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName RabbitConfig
 * @Description TODO
 * @Author Kx
 * @Date 2025/10/21 19:23
 * @Version 1.0
 */
@Configuration
public class RabbitConfig {
    public static final String NEWS_EXCHANGE = "news.exchange";
    public static final String NEWS_CREATE_QUEUE = "news.create.queue";
    public static final String NEWS_DELETE_QUEUE = "news.delete.queue";
    public static final String NEWS_CREATE_ROUTING_KEY = "news.create.key";
    public static final String NEWS_DELETE_ROUTING_KEY = "news.delete.key";

    /**
     * 替换默认的SimpleMessageConverter序列化器
     */
    @Bean
    public MessageConverter messageConverter() {
        return new Jackson2JsonMessageConverter();
    }
}
